import qs from "qs";
import request, { Method } from "../request";
import { perSize } from "../util";

// 文章推荐
export const articleRecommend = () => request(`/article-recommend`, Method.get);

//文献获取
export const literatureRecommend = () => request("/literature-recommend", Method.get);

// 文献区域字典
export const literatureDict = () => request("/dict-literature-list", Method.get);

// 文献列表
export const literatureList = (id: string, page: number = 1, name: string | null = null, size: number = perSize) => {
  const query = {
    page,
    size,
    filters: {
      name
    }
  };
  return request(`/literature-list/${id}?${qs.stringify(query, { skipNulls: true })}`, Method.get);
};

// 文章字典
export const articleDict = () => request("/dict-article-list", Method.get);

// 文章列表
export const articleList = (id: string, page: number, name: string | null = null, size: number = perSize) => {
  const query = {
    page,
    size,
    filters: {
      name
    }
  };
  return request(`/article-list/${id}?${qs.stringify(query, { skipNulls: true })}`, Method.get);
};
